package com.xy.manage.service.impl;


import java.util.List;
import java.util.Map;
import java.util.Date;
import com.xy.core.util.BeanUtil;
import com.xy.common.page.Pagination;
import com.xy.core.service.impl.BaseServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.xy.manage.dao.TservicelogDao;
import com.xy.manage.model.Tservicelog;
import com.xy.manage.service.TservicelogService;

@Service
@Transactional
public class TservicelogServiceImpl extends BaseServiceImpl<Tservicelog> implements
		TservicelogService {
	private TservicelogDao tservicelogDao;

	public TservicelogServiceImpl(TservicelogDao paramAppRoleDao) {
		super(paramAppRoleDao);
		this.tservicelogDao = paramAppRoleDao;
	}

	@Override
	public boolean checkExist(String paraName, String paraValue) {
		return tservicelogDao.checkExist("Tservicelog", paraName, paraValue);
	}

	@Override
	public List<Tservicelog> getTservicelog(Map<String, Object> map) {
		return tservicelogDao.getTservicelog(map);
	}
	@Override
	public Pagination getTservicelogByPage(Map<String, Object> map, int pageNo,
			int pageSize) {
		// TODO Auto-generated method stub
		return tservicelogDao.getTservicelogByPage(map, pageNo, pageSize);
	}
	 
   @Override
	public Tservicelog save(Tservicelog tservicelog) {
	//	tservicelog.setModtime(new Date());
		if(tservicelog.getLogid()==null){
			//新增
        	return super.save(tservicelog);
		}else{
			//更新
			Tservicelog tservicelog1=tservicelogDao.get(tservicelog.getLogid());
			try {
				BeanUtil.copyNotNullProperties(tservicelog1, tservicelog);
			} catch (Exception e) {
				e.printStackTrace();
			}  
			return super.save(tservicelog1);
		}
	}
}